package ca.bcit.comp_3512.assignment_02.business_logic;

import java.io.Serializable;

import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
import javax.inject.Named;

import ca.bcit.comp_3512.assignment_02.data_managers.WeeklyEntryManager;
import ca.bcit.comp_3512.assignment_02.data_models.WeeklyEntry;


@Named("newWeek")
@RequestScoped
public class NewWeeklyEntry implements Serializable
{
    @Inject WeeklyEntryManager weeklyEntryManager;
    @Inject EditableWeeklyEntryList editableWeeklyEntryList;
    private Double friday;
    private Double monday;
    private String notes;
    private Integer projectID;
    private Double saturday;
    private Double sunday;
    private Double thursday;
    private Double tuesday;
    private Double wednesday;
    private Integer week;
    private String workPlaceID;
    private Integer year;
    
    public NewWeeklyEntry() {}
    
    public String addWeek()
    {
        WeeklyEntry temp = new WeeklyEntry();
        
        temp.setFriday(friday);
        temp.setMonday(monday);
        temp.setNotes(notes);
        temp.setProjectID(projectID);
        temp.setSaturday(saturday);
        temp.setSunday(sunday);
        temp.setThursday(thursday);
        temp.setTuesday(tuesday);
        temp.setWednesday(wednesday);
        temp.setWeek(week);
        temp.setWorkPlaceID(workPlaceID);
        temp.setYear(year);
        
        weeklyEntryManager.persist(temp);
        editableWeeklyEntryList.refreshList();
        
        friday = null;
        monday = null;
        notes = null;
        projectID = null;
        saturday = null;
        sunday = null;
        thursday = null;
        tuesday = null;
        wednesday = null;
        week = null;
        workPlaceID = null;
        year = null;
        
        return "schedule?faces-redirect=true";
    }

    public Double getFriday()
    {
        return friday;
    }

    public Double getMonday()
    {
        return monday;
    }

    public String getNotes()
    {
        return notes;
    }

    public Integer getProjectID()
    {
        return projectID;
    }

    public Double getSaturday()
    {
        return saturday;
    }

    public Double getSunday()
    {
        return sunday;
    }

    public Double getThursday()
    {
        return thursday;
    }

    public Double getTuesday()
    {
        return tuesday;
    }

    public Double getWednesday()
    {
        return wednesday;
    }

    public Integer getWeek()
    {
        return week;
    }

    public String getWorkPlaceID()
    {
        return workPlaceID;
    }

    public Integer getYear()
    {
        return year;
    }

    public void setFriday(Double friday)
    {
        this.friday = friday;
    }

    public void setMonday(Double monday)
    {
        this.monday = monday;
    }

    public void setNotes(String notes)
    {
        this.notes = notes;
    }

    public void setProjectID(Integer projectID)
    {
        this.projectID = projectID;
    }

    public void setSaturday(Double saturday)
    {
        this.saturday = saturday;
    }

    public void setSunday(Double sunday)
    {
        this.sunday = sunday;
    }

    public void setThursday(Double thursday)
    {
        this.thursday = thursday;
    }

    public void setTuesday(Double tuesday)
    {
        this.tuesday = tuesday;
    }

    public void setWednesday(Double wednesday)
    {
        this.wednesday = wednesday;
    }

    public void setWeek(Integer week)
    {
        this.week = week;
    }

    public void setWorkPlaceID(String workPlaceID)
    {
        this.workPlaceID = workPlaceID;
    }

    public void setYear(Integer year)
    {
        this.year = year;
    }
}
